--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Commit de7e0996ce218f5b697c33ff3d64f1451f4a1f0a
Parents : 7377b69
Author : Mark Qvist <bc7291552be7a58f361522990465165c>
Date : 2026-04-26T00:47:16+02:00
Track remote refs on list-for-pull for push bundle exclusion
Changes
Diff
diff --git a/RNS/Utilities/rngit/client.py b/RNS/Utilities/rngit/client.py
index 8d312062..28220fe4 100644
--- a/RNS/Utilities/rngit/client.py
+++ b/RNS/Utilities/rngit/client.py
@@ -120,6 +120,7 @@ class ReticulumGitClient():
self.response_metadata = None
self.ref_batch_size = self.REF_BATCH_SIZE
+ self.remote_refs = {}
# Response progress tracking
self.response_progress = 0
@@ -391,7 +392,19 @@ class ReticulumGitClient():
if status_byte != 0: self.abort(f"Server refused list: {payload.decode('utf-8', errors='ignore')}")
- git_stdout.write(payload.decode("utf-8"))
+ response_text = payload.decode("utf-8")
+
+ if for_push:
+ self.remote_refs = {}
+ for line in response_text.split('\n'):
+ line = line.strip()
+ if not line: continue
+ parts = line.split(' ', 1)
+ if len(parts) == 2:
+ sha, ref_name = parts
+ self.remote_refs[ref_name] = sha
+
+ git_stdout.write(response_text)
git_stdout.write("\n") # Required to terminate list
git_stdout.flush()
@@ -500,6 +513,8 @@ class ReticulumGitClient():
bundle_path = tmpdir + "/push.bundle"
create_cmd = ["git", "bundle", "create", bundle_path, local_ref]
+ if remote_ref in self.remote_refs: create_cmd.append(f"^{self.remote_refs[remote_ref]}")
+
if progress_enabled: create_cmd.insert(3, "--progress")
create_result = subprocess.run(create_cmd, stderr=stderr_arg, stdout=subprocess.DEVNULL)
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────